import { fromJS } from "immutable";
import { useEffect, useState } from "react";

interface Obj {
    a: {
        b: number
    }
}

export default function TestImmutable1 () {
    const [state, setState] = useState(fromJS<Obj>({
        a: {
            b: 1
        }
    }))

    useEffect(() => {
        setTimeout(() => {
            setState(state.setIn(['a', 'b'], 2))
        }, 2000);
    })

    let count = state.getIn(['a', 'b']) as number
    return <div>{count}</div>
}